/*
 *  shnodecontainerwidget_qt.h
 *  shaderz_v3
 *
 *  Created by Anjali on 4/19/11.
 *  Copyright 2011 __MyCompanyName__. All rights reserved.
 *
 */

#ifndef	__SH_NODECONTAINER_WIDGET_H__
#define __SH_NODECONTAINER_WIDGET_H__

#include <map>
#include <vector>
#include <QtGui/QWidget>
#include <QAction>

#include "shnode.h"
#include "shnodeui_qt.h"

class QMenu;
class QPainterPath;

namespace shaderzui
{
	namespace qt
	{
		class shNodeContainerWidget : public QWidget
		{
			Q_OBJECT
			
		public:
			shNodeContainerWidget(QWidget* InParent);
			
		protected:
			enum nodeTypes	{ SHNT_CONST=0, SHNT_MATH_ADD, SHNT_MATH_SUB, SHNT_MATH_MUL, SHNT_MATH_DIV, SHNT_RGBA, SHNT_MAX };
			
		public slots:
			void onCreateConstantNode();
			void onCreateMathAddNode();
			void onCreateMathSubNode();
			void onCreateMathMulNode();
			void onCreateMathDivNode();
			void onCreateRGBANode();
			void onNodeDestroyed( unsigned int InNodeCoreAddress );
			void onStubInteraction( shStubInteraction InInteraction, linkStubUI* InStubUI, shNodeUI* InNodeUI );
			
		protected:
			virtual void mouseMoveEvent( QMouseEvent* InEventInfo );
			virtual void mouseReleaseEvent( QMouseEvent* InEventInfo );
			virtual void paintEvent( QPaintEvent* InEventInfo );
			virtual QMenu* generateRClickContextMenu();
			
			virtual void drawHelperNodeConnections( shaderz::shNode* InNode, QPainterPath& InPainterPath );
			
		protected:
			std::map<shaderz::shNode*, shNodeUI*>	mNodeToUiMap;
			std::vector<QAction*>					mActionList;
			std::pair<shNodeUI*, linkStubUI*>		mCurrentlySelectedStubInfo;
			std::pair<shNodeUI*, linkStubUI*>		mCurrentlyHoveringStubInfo;
			
		private:
			typedef QWidget	ParentClass;
		};
	}
}

#endif